package spring.example.cloud.service.controller;

import cloud.estate.commons.bean.Building;
import cloud.estate.commons.util.JsonResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import spring.example.cloud.service.BuildingService;

@RestController
@RequestMapping("/building")
public class BuildingController {
    @Resource
    private BuildingService buildingService;

    @PostMapping("/addOneBuilding")
    public JsonResult AddOneBuilding(Building building) {
        return buildingService.AddOneBuilding(building);
    }
    @PostMapping("/deleteOneBuilding/{id}")
    public JsonResult DeleteOneBuilding(@PathVariable("id") String id) {
        return buildingService.DeleteOneBuilding(id);
    }
    @PostMapping("/updateOneBuilding")
    public JsonResult UpdateOneBuilding(Building building) {
        return buildingService.UpdateOneBuilding(building);
    }
    @GetMapping("/findOneBuilding/{id}")
    public JsonResult FindOneBuilding(@PathVariable("id") String id) {
        return buildingService.FindOneBuilding(id);
    }
    @GetMapping("/findAllBuilding")
    public JsonResult FindAllBuilding() {
        return buildingService.FindAllBuilding();
    }
}
